package com.banksoft.front.bean;

import com.banksoft.admin.bean.MemberType;

import java.util.Comparator;

/**
 * Created by vanjoger on 2017/2/5.
 */
public class UserTypeCompare implements Comparator {
    @Override
    public int compare(Object o1, Object o2) {
        UserBean bean1 = (UserBean) o1;
        UserBean bean2 = (UserBean) o2;
        if(MemberType.Customer.name().equals(bean1.getUserType())){
            return -1;
        }
        if(MemberType.Gold.name().equals(bean1.getUserType())){
            if(MemberType.Customer.name().equals(bean2.getUserType())){
                return -1;
            }else{
                return 1;
            }
        }
        if(MemberType.General.name().equals(bean1.getUserType())){
            if(MemberType.Customer.name().equals(bean2.getUserType())){
                return -1;
            }if(MemberType.Gold.name().equals(bean2.getUserType())){
                return -1;
            }else{
                return 1;
            }
        }
        if(MemberType.Partner.name().equals(bean1.getUserType())){
            return -1;
        }
        return 0;
    }
}
